<template>
  <div>
    <div class="top">
      <div class="wode">
        <van-tabs>
          <van-tab title="政府服务">
            <div class="navbox">
              <ul>
                <li v-for="(v, i) in moData" :key="i" @click="fun(v.url)">
                  <p><img :src="v.imgUrl" /></p>
                  <p class="toptex">{{ v.title }}</p>
                </li>
              </ul>
            </div>
          </van-tab>
          <van-tab title="生活缴费">
            <div class="navbox">
              <ul>
                <li v-for="(v, i) in mobDat" :key="i" @click="fun(v.url)">
                  <p><img :src="v.imgUrl" /></p>
                  <p class="toptex">{{ v.title }}</p>
                </li>
              </ul>
            </div>
          </van-tab>
          <van-tab title="便民服务">
            <div class="navbox">
              <ul>
                <li v-for="(v, i) in mocData" :key="i" @click="fun(v.url)">
                  <p><img :src="v.imgUrl" /></p>
                  <p class="toptex">{{ v.title }}</p>
                </li>
              </ul>
            </div>
          </van-tab>
          <van-tab title="美食娱乐">
            <div class="navbox">
              <ul>
                <li v-for="(v, i) in modDat" :key="i" @click="fun(v.url)">
                  <p><img :src="v.imgUrl" /></p>
                  <p class="toptex">{{ v.title }}</p>
                </li>
              </ul>
            </div>
          </van-tab>
        </van-tabs>
      </div>
      <div class="kong"></div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["moreData"],
  methods: {
    fun(url) {
      // 编程式方式进行----路由跳转
      this.$router.push(url);
    },
  },
  //使用计算属性-----截取部分数据
  computed: {
    moData: function () {
      return this.moreData.slice(2, 7);
    },
    mobDat: function () {
      return this.moreData.slice(9, 13);
    },
    mocData: function () {
      return this.moreData.slice(10, 16);
    },
    modDat: function () {
      return this.moreData.slice(5, 13);
    },
  },
};
</script>

<style lang="less" scoped>
.top {
  width: 100%;
  height: 0.46rem;
}
.wode {
  width: 100%;
  height: 0.16rem;
  line-height: 0.16rem;
  margin: 0.125rem auto;
  font-size: 0.15rem;
  font-weight: bold;
}
.kong {
  width: 100%;
  height: 0.07rem;
  background-color: #efefef;
}
.navbox {
  width: 95%;
  height: auto;
  background-color: #fff;
  margin: auto;
}
ul {
  display: flex;
  flex-wrap: wrap;
  height: 100%;

  li {
    width: 25%;
    text-align: center;
    font-size: 0.14rem;
    align-items: center;
    margin-top: 0.2rem;
    margin-bottom: 0.1rem;

    p {
      span {
        font-size: 0.3rem;
      }
    }
  }
}
.toptex {
  margin-top: 0.0067rem;
}
img {
  width: 0.3rem;
  height: 0.3rem;
}
</style>